import { _decorator, EventTouch, find, Node } from "cc";
import { ecs } from "db://oops-framework/libs/ecs/ECS";
import { CCComp } from "db://oops-framework/module/common/CCComp";

const { ccclass, property } = _decorator;

/** 地图 */
@ccclass("MapViewComp")
@ecs.register('MapView', false)
export class MapViewComp extends CCComp {
    /** 底部特效层 */
    effect_bottom: Node = null!;
    /** 游戏层（放置角色、技能特效） */
    game: Node = null!;
    /** 顶部特效层 */
    effect_top: Node = null!;

    onLoad() {
        this.effect_bottom = find("map/effect_bottom", this.node)!;
        this.game = find("map/game", this.node)!;
        this.effect_top = find("map/effect_top", this.node)!;

        this.node.on(Node.EventType.TOUCH_END, this.onTouchEnd, this);
    }
    private onTouchEnd(e: EventTouch) {
        switch (e.target.name) {
            case "scene":
                console.log("点击了地图");
                break;
        }
    }

    reset(): void {
        this.node.destroy();
    }
}